package com.g5.edu.controller;


import com.g5.edu.model.DfTeachersInfo;
import com.g5.edu.service.IDfTeachersInfoService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 老师信息 前端控制器
 * </p>
 *
 * @author admin
 * @since 2021-10-29
 */
@Slf4j
@RestController
@RequestMapping("/edu/dfTeachersInfo")
public class DfTeachersInfoController {

@Autowired(required = false)
private IDfTeachersInfoService dfTeachersInfoService;
    /*
     获取前10条话题
    */
    @GetMapping("/teacher_list")
    public List<DfTeachersInfo> teacher_list(Integer num){

        List<DfTeachersInfo> list
                =dfTeachersInfoService.getTeacherlist(num);
        return list;
    }


    @GetMapping("/teacher_list_page")
    public PageInfo<DfTeachersInfo> teacher_list_page(
            Integer pageNum){

        Integer pageSize = 12;
        if (pageNum == null) {
            pageNum = 1;
        }

        PageInfo<DfTeachersInfo> pageInfo
                =dfTeachersInfoService
                .getTeacherListPage(pageNum,pageSize);
        System.out.println(pageInfo.toString());
        return pageInfo;

    }
}
